package sparrowGui.skin
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	
	import sparrowGui.SparrowGUI;
	import sparrowGui.item.LabelItem;
	
	/**
	 * 数字单步增减组件的皮肤,里面有只能输文字的文本和增加减少按钮
	 * @author Pelephone
	 */	
	public class NumericStepperSkin extends Sprite
	{
		public var txt_inputNum:TextField;		//输入文本,只能输入数字
		public var btn_increase:DisplayObject;	//增加按钮
		public var btn_decrease:DisplayObject;	//减少按钮
		public function NumericStepperSkin()
		{
			super();
			
			var padding:int = 2;
			
			txt_inputNum = new TextField();
			txt_inputNum.background = true;
			txt_inputNum.border = true;
			txt_inputNum.text = "0";
			txt_inputNum.type = TextFieldType.INPUT;
			txt_inputNum.maxChars = 10;
			txt_inputNum.width = 70;
			txt_inputNum.height = 18;
//			txt_inputNum.restrict = '0-9';
//			txt_inputNum.autoSize = TextFieldAutoSize.LEFT;
			
			btn_decrease = new LabelItem("-",null,SparrowGUI.getIns().btn_base);
			btn_decrease.x = txt_inputNum.x + txt_inputNum.width + padding;
			
			btn_increase = new LabelItem("+",null,SparrowGUI.getIns().btn_base);
			btn_increase.x = btn_decrease.x + btn_decrease.width + padding;
			
			txt_inputNum.name = "txt_inputNum";
			btn_increase.name = "btn_increase";
			btn_decrease.name = "btn_decrease";
			
			addChild(txt_inputNum);
			addChild(btn_increase);
			addChild(btn_decrease);
		}
	}
}